home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / RAND / ALL95.LZH / letters_tfb / text0008.txt < prev    next >
Encoding:
Text File  |  1995-10-04  |  8.8 KB  |  185 lines

  1. >To: Laurent S.
  2. >From: bleroy@moka.ccr.jussieu.fr (Bertrand Le Roy)
  3. >Subject: J'ai tout compris.
  4. >Cc: 
  5. >Bcc: 
  6. >X-Attachments: 
  7. >
  8. >Salut!
  9. >
  10. >En fait, la methode utilisΘe par doom est sans doute plus efficace que
  11. celle que je proposais. Mais elle est moins facile a mettre en oeuvre. Je
  12. pense qu'il faudra bouffer quelques sources car on ne trouvera pas toutes
  13. les astuces tous seuls (a mon avis). J'aurai les sources de doom, mais je ne
  14. peux pas dire quand.
  15. >Alors voila. L'espace est divise en polygones CONVEXES. La raison est toute
  16. simple, c'est que quand on est dans un polygone convexe, aucun mur ne peut
  17. en cacher un autre. On peut donc les dessiner sans se preoccuper de rien. En
  18. plus, ainsi, les sprites contenus dans ce polygone sont toujours devant tous
  19. les murs => on n'a qu'a les dessiner en surimpression, apres avoir dessine
  20. les murs, et le tour est joue. En plus, le format graphique permet de
  21. dessiner avec des transprences, sans masque: les dessins sont organises en
  22. colonnes, elles-memes separees en traits solides.
  23. >La ou ca se gate, c'est qu'il y a des transparences. C'est pourquoi il y a
  24. pour chaque niveau un arbre BSP qui indique ce qui est a droite et a gauche
  25. de chaque separation de sous-secteur convexe.
  26. >Je pense (mais c'est une premiere impression) qu'il faut dessiner le
  27. sous-secteur ou est le joueur. Puis, pour chaque mur a deux face (donc
  28. susceptible de donner une vue, par transparence, sur autre chose) visible,
  29. on dessine les textures haute et basses (jamais transparentes IIRC), on
  30. determine le secteur de l'autre cote, qu'on dessine, clippe par le trapeze
  31. de notre mur a deux faces. Pour ce nouveau sous-secteur, on recommence la
  32. meme chose, recursivement. Quand on a fini de dessiner un secteur, on
  33. dessine les sprites qu'il contient, et on repasse la main au sous-secteur
  34. appelant. Ce sous-secteur appelant peut maintenant dessiner son mur a deux
  35. faces au-dessus du secteur fils qui vient d'etre dessine.
  36. >Je pense que ca doit marcher, et assez vite. Un avantage (ou en est-ce un?)
  37. est qu'on dessine chaque mur d'un seul coup. Un inconvenient est le clipping
  38. selon un trapeze (les cotes droit et gauche sont bien sur verticaux). Mais
  39. ca peut s'arranger en generalisant une partie de l'algo que j'avais suggere
  40. la derniere fois dans mon bureau: tu peux gerer, pour chaque colonne, le
  41. point le plus haut et le point le plus bas. Ca suffit. Et tu clippes chaque
  42. colonne dessinee avec ces limites. D'ailleurs, si on fait ca, reduire la
  43. taille de l'ecran revient simplement a chager les valeurs de depart de cette
  44. table ;)
  45. >Les plafonds, meme textures, peuvent entrer dans ce shΘma: on les dessine
  46. juste apres les murs.
  47. >Ceci dit, je pense qu'il doit y avoir de nombreuses optimisations a faire
  48. sur ce schema. A mon avis, Webview doit etre la meilleure source a notre
  49. disposition pour l'instant. En effet, ce programme a beneficie de la
  50. participation de nombreuses personnes, les sources etant publics et
  51. constament ameliores.
  52. >Dis-moi ce que tu en penses.
  53. >Je serai la lundi (peut-etre pas toute la journee ceci dit)
  54. >
  55. >Salut.
  56. >Bertrand
  57. >
  58. >Tiens, j'ai recupere un texte assez interessant. L'algorithme propose est
  59. un peu different:
  60. >
  61. >> misc. discussion deleted
  62. >
  63. >I've seen threads like this on c.g.a, doom-editing mailing
  64. >list, r.g.p and else. There are lots of theories and
  65. >descriptions (e.g. in the PCGPE), but nobody (expect
  66. >the Id/Raven/...) guys really knows. There's even a 
  67. >disassembly of a pre-BSP beta of DOOM floating around...
  68. >
  69. >Now I'll do a quick description of *our* theory (which
  70. >happens to be the approach we use :). Btw. we got some
  71. >hints from people who have been/are now working for
  72. >commercial companies, and even they do not agree ;-).
  73. >
  74. >
  75. >a) wall rendering is done vertically, by one
  76. >assembly loop, constant z, no divide, one table lookup
  77. >for "fog"-like lighting remapping. Wall columns
  78. >are stored as posts:
  79. >
  80. >   1 byte = starting row (in texture/pixmap space)
  81. >   1 byte = number of non-transparent pixels
  82. >   followed by all the non-transparent pixels
  83. >   
  84. >DOOM treats opaque walls likes sprites and partly
  85. >transparent wall patches.
  86. >
  87. >b) floor rendering is done horizontally (methinks),
  88. >by another assembly loop (as in all but one direction,
  89. >you'll go along u,v at an angle in texture space).
  90. >Floor/ceilings textures are 64x64 pixel "flat" pixmaps
  91. >only, no patches. They are stored using pixmap interleaving
  92. >(flat1 row1, flat2 row1, flat3 row1, flat4 row1, flat1 row2...)
  93. >which allows another texture mapping loop optimization.
  94. >See Sean Barretts most recommended "Texture Mapping"
  95. >description in the PCGPE.
  96. >
  97. >c) Restrictions are: only one floor, one ceiling per
  98. >x,y - thus only one wall per x,y, always perpendicular
  99. >to xy plane. If there's only one wall, there are
  100. >only two differences in height possible between
  101. >adjacent sectors (sounds familiar :), thus only
  102. >an upper, a lower and a middle texture are possible
  103. >on each side of the wall.
  104. >Consequence: if you are rendering front-to-back, top
  105. >will get "down" in each column only, and bottom will
  106. >get "up". As soon as top >= bottom, column is done,
  107. >as soon as all columns are done, fron-to-back is
  108. >finished (do sprites/transparent middles now, below).
  109. >
  110. >d) Rendering is done using BSP traversal. During traversal,
  111. >each subtree's bounding box is checked for intersection
  112. >with the (2D) view volume (all DOOM stuff is 2D).
  113. >If there's no intersection, subtree is completely outside
  114. >of view, and discarded completely, or it is completely
  115. >inside, skip further intersection checks (exepensive, too).
  116. >If intersecting, continue checks during traversal.
  117. >
  118. >For each traversal step, you'll get a subsector (convex
  119. >2D volume) i.e. a list of possibly visible walls. You
  120. >have to sort in the sprites (that's the part I don't understand:
  121. >BLOCKMAP only provides "ThingIsInSector" information, not
  122. >the appropriate subsector - I dunno how to merge this) and
  123. >clip them, but you put the sprites on some stack, for
  124. >back-to-front later. You'll draw the wall per lineseg,
  125. >draw lowers/upper and single-sided (non-transparent) middles
  126. >(possibly partly transparent middle textures on stack, like
  127. >sprites). For each of the seg's textures, you draw 
  128. >vertical columns. Now you'll get a gap to the last bottom (top)
  129. >value for the first column of each lower (upper). These are the start
  130. >columns of floor (ceiling) slices. The very last column of the same
  131. >seg's lower texture provides you the end columns. You draw those
  132. >slices immediately, but you have to keep track of top/bottom (as some
  133. >wall drawn earlier on might hide (parts of) the floor). You
  134. >use the upmost start, go towards end, and each time top is
  135. >below, you have some slices finished, as the intersection
  136. >provides ends for the slice. If top goes up next column, new
  137. >starts. It *is* complicated to compare top/bottom clipping
  138. >boundaries while doing horizontal slices, but, in a way,
  139. >you are doing it on two edges of a four-vertex convex polygon
  140. >only (the part of the floor "below" the current seg's lower
  141. >texture).
  142. >
  143. >You traverse the BSP, rendering subsector's walls and floors/ceilings
  144. >step by step, until all columns are done. Now you draw the
  145. >pre-clipped visible sprite/transparent middle slices back-to-front
  146. >from stack, painters algo. As soon as stack's empty, you're done
  147. >with this frame.
  148. >
  149. >Phew.
  150. >
  151. >I know of a couple of alternatives (actually, we are trying to
  152. >do it a bit different, and we are *still* working on the floors :-(,
  153. >but that's the basic idea. If you are doing a complete BSP
  154. >traversal to get a priority sorted polygon list, w/o any
  155. >view volume clipping, or if you are doing floors back-to-front
  156. >to fill gaps (especially the GUARD VAL polygon fill used in wt-0.04)
  157. >you're likely to be slower. If you want to do more than one
  158. >visible floor per x,y, or real 3D, or sprites/moving objects
  159. >front-to-back, too, you'll have to maintain a list of
  160. >already drawn parts of each screen column (for per column-rendering,
  161. >or per row, alternatively, and completely different for polygon
  162. >rendering, I guess :) and I don't think doing floors by row will work
  163. >nice with having per-column-lookups...
  164. >
  165. >OK, hope this helps. Somebody mentioned DVIEW.ZIP to me, a C++ source
  166. >on x2ftp.oulu.fi that does BSP traversal in a similar way, drawing
  167. >floor in horizontal slices (but no texture mapping). Haven't looked
  168. >at it.
  169. >
  170. >If anybody got a really good suggestion to do it else, please
  171. >let me know.
  172. >
  173. +-----------------------------------------------------------+
  174. |Bertrand Le Roy      |A Darwinian theory of Gravitation:   |
  175. |bleroy@ccr.jussieu.fr|In the beginning,  mature apples fell|
  176. |tel. 44.27.72.95     |in all directions. But only the trees|
  177. |fax. 44.27.72.87     |whose apples fell down have survived.|
  178. +-----------------------------------------------------------+
  179. |Laboratoire de Gravitation et Cosmologie Relativistes      |
  180. |Universite Pierre et Marie Curie, tour 22-12, 4e etage     |
  181. |4, place Jussieu, 75252 Paris Cedex 05                     |
  182. +-----------------------------------------------------------+
  183.  
  184.  
  185.